<?php

namespace app\closure;

class Test
{
    private $routes = [];
    private $aaa;

    public function addRoute($route, \Closure $callback)
    {
        $this->routes[$route] = $callback->bindTo($this,__CLASS__);
    }

    public function dispatch($currentRoute)
    {
        foreach ($this->routes as $route => $callback) {
            if ($currentRoute == $route) {
                $callback();
            }
        }
    }
}